package com.zy.net.okhttp

import com.zy.net.NetServiceInterface
import com.zy.net.data.DataRecord
import com.zy.net.retrofit.RetrofitImpl
import okhttp3.Callback
import okhttp3.Request
import okhttp3.Response

class OkHttpNetServiceImpl : NetServiceInterface {
    override fun request(request: Request, responseCallback: Callback) {
        OkHttpImpl.request(request, responseCallback)
    }

    override fun request(url: String, responseCallback: Callback) {
        val request: Request = Request.Builder().url(url).build()
        OkHttpImpl.request(request, responseCallback)
    }

    override fun execute(url: String): Response {
        val request: Request = Request.Builder().url(url).build()
        return OkHttpImpl.execute(request)
    }

    override fun execute(request: Request): Response {
        return OkHttpImpl.execute(request)
    }

    override fun getAllStr(callback: retrofit2.Callback<String>) {
        RetrofitImpl.getAllStr(callback)
    }

    override fun getAll(callback: retrofit2.Callback<DataRecord>) {
        RetrofitImpl.getAll(callback)
    }
}